package actions.loadpages;

import java.sql.SQLException;
import java.util.Map;

import javax.jdo.annotations.Persistent;

import com.google.appengine.api.datastore.Blob;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import dominio.Categoria;


public class loadModCategoria extends ActionSupport{

	private static final long serialVersionUID = 1L;
	private Long id;
	
	private String name;
	
	private String descripcion;

	private Long id_propietario;

	private Map<String, Object> session;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}


	public Long getId_propietario() {
		return id_propietario;
	}

	public void setId_propietario(Long id_propietario) {
		this.id_propietario = id_propietario;
	}

	public String execute(){
		

		session = ActionContext.getContext().getSession();
		if (session.get("usu")!=null){
			Categoria cat = Categoria.read(id, false);
			id=cat.getId();
			name=cat.getName();
			descripcion=cat.getDescripcion();
			id_propietario=cat.getId_propietario();
			return SUCCESS;
			
		}
		else{
			return ERROR;
		}
		
	}

	public Map getSession() {
		return session;
	}

	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

}